﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ButtonTree2
{
    public partial class Form1 : Form
    {
        public Form1()
        {

            AddMenuItem(this.menu, menu1, menu2);
            InitializeComponent();

        }


        #region 定义菜单栏
        ContextMenuStrip menu = new ContextMenuStrip();
        ToolStripMenuItem menu1 = new ToolStripMenuItem() { Name = "Menu1", AccessibleName = "Menu1" };
        ToolStripMenuItem menu2 = new ToolStripMenuItem() { Name = "Menu2", AccessibleName = "Menu" };
        #endregion

        private void AddMenuItem(ContextMenuStrip menu, params ToolStripMenuItem[] items)
        {
            foreach (ToolStripMenuItem item in items)
            {
                menu.Items.Add(item);
            }
        }
    }
}
